/**
 *
 */
package stc.skymobi.netty.handler.codec.http.request;

import io.netty.handler.codec.http.DefaultFullHttpRequest;
import io.netty.handler.codec.http.FullHttpRequest;
import stc.skymobi.util.DefaultPropertiesSupport;
import stc.skymobi.util.MutablePropertyable;
import stc.skymobi.util.Propertyable;

import java.util.Map;


/**
 * @author hp
 */
public class HttpRequestExt extends DefaultFullHttpRequest implements Propertyable, MutablePropertyable, FullHttpRequest {
    private DefaultPropertiesSupport propertiesSupport = new DefaultPropertiesSupport();

    public HttpRequestExt(FullHttpRequest request) {
        super(request.getProtocolVersion(), request.getMethod(), request.getUri(), request.content());
        headers().set(request.headers());
        trailingHeaders().set(request.trailingHeaders());
    }

    @Override
    public Object getProperty(String key) {
        return propertiesSupport.getProperty(key);
    }

    @Override
    public Map<String, Object> getProperties() {
        return propertiesSupport.getProperties();
    }

    @Override
    public void setProperty(String key, Object value) {
        propertiesSupport.setProperty(key, value);
    }

    @Override
    public void setProperties(Map<String, Object> properties) {
        propertiesSupport.setProperties(properties);
    }
}
